package aecs

import (
	"encoding/json"
)

// func GetDescribe_instance_types() *struct {
// 	a int
// 	b int
// 	instanceTypeItem []struct {
// 		InstanceTypeId string `json:"InstanceTypeId" xml:"InstanceTypeId"`
// 		InstanceType string `json:"InstanceType" xml:"InstanceType"`

// 	}
// } {
// 	return &struct {
// 		a int
// 	}{
// 		a: 1,
// 	}
// }

// 硬编码实例规格
var instanceTypesJson = `[{
    "Name": "VGPU1R9001@100G",
    "Ram": 65536,
    "Vcpus": 16,
    "ExtraSpecs": {
        "MachineTypeDescGPU": "1*G3090",
        "MachineTypeDescCPU": "EPYC7742",
        "CustomVifMQNum": "4",
        "HWFirmwareType": "bios",
        "MachineTypeDescVirtualizationType": "gpu",
        "CustomKVMHidden": "off",
        "StrictSpecsPin": "cross_numa",
        "CustomGPUType": "consumer",
        "PCIPassthroughAlias": "RTX3090:1"
    },
    "Disk": 100,
    "ID": "fc8a55a5-b033-40da-aff0-bc29da36431e"
},
{
    "Name": "VGPU1R9001@150G",
    "Ram": 65536,
    "Vcpus": 16,
    "ExtraSpecs": {
        "MachineTypeDescGPU": "1*G3090",
        "MachineTypeDescCPU": "EPYC7742",
        "CustomVifMQNum": "4",
        "HWFirmwareType": "bios",
        "MachineTypeDescVirtualizationType": "gpu",
        "CustomKVMHidden": "off",
        "StrictSpecsPin": "cross_numa",
        "CustomGPUType": "consumer",
        "PCIPassthroughAlias": "RTX3090:1"
    },
    "Disk": 150,
    "ID": "24c2f612-9bf2-45c5-9ec4-779b43e7fe6f"
},
{
    "Name": "VGPU1R9001",
    "Ram": 65536,
    "Vcpus": 16,
    "ExtraSpecs": {
        "MachineTypeDescGPU": "1*G3090",
        "MachineTypeDescCPU": "EPYC7742",
        "CustomVifMQNum": "4",
        "HWFirmwareType": "bios",
        "MachineTypeDescVirtualizationType": "gpu",
        "CustomKVMHidden": "off",
        "StrictSpecsPin": "cross_numa",
        "CustomGPUType": "consumer",
        "PCIPassthroughAlias": "RTX3090:1"
    },
    "Disk": 256,
    "ID": "2eb6c636-eccd-407b-bde8-ab67e5b5c569"
}
]`

type GpuInstanceType struct {
	Name       string
	Ram        int
	Vcpus      int
	ExtraSpecs ExtraSpecs
	Disk       int
	ID         string
}

type ExtraSpecs struct {
	MachineTypeDescGPU                string
	MachineTypeDescCPU                string
	CustomVifMQNum                    string
	HWFirmwareType                    string
	MachineTypeDescVirtualizationType string
	CustomKVMHidden                   string
	StrictSpecsPin                    string
	CustomGPUType                     string
	PCIPassthroughAlias               string
}

func (c *Client) DescribeGPUInstances() ([]GpuInstanceType, error) {

	var instanceTypes []GpuInstanceType
	err := json.Unmarshal([]byte(instanceTypesJson), &instanceTypes)
	if err != nil {
		return nil, err

	}
	return instanceTypes, nil
}
